package com.open.capacity.paper.controller;

import com.open.capacity.common.exception.controller.ControllerException;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.log.annotation.LogAnnotation;
import com.open.capacity.paper.service.SuggestService;
import com.open.capacity.paper.vo.PaperVo;
import com.open.capacity.paper.vo.SuggestVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author liangd
 * @since 2021-02-23 17:56
 */
@Api(tags = "意见反馈")
@RestController
@RequestMapping("/suggest")
public class SuggestController {

    @Autowired
    private SuggestService suggestService;

    /**
     * 模糊查询
     */
    @GetMapping("/getSuggestions")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "分页起始位置",required = true, dataType = "Integer"),
            @ApiImplicitParam(name = "limit", value = "分页结束位置",required = true, dataType = "Integer")
    })
    @ApiOperation(value = "后台管理查询所有意见标识")
    @LogAnnotation(module = "paper-center")
    public PageResult<SuggestVo> getSuggestions(@RequestParam Map<String, Object> params) throws ControllerException {
        try {
            return suggestService.getSuggestions(params);
        } catch (Exception e) {
            throw new ControllerException(e);
        }
    }
}
